

import requests
session = requests.Session()
img = session.get('https://kyfw.12306.cn/passport/captcha/captcha-image?login_site=E&module=login&rand=sjrand&0.11104019066524184')
#print(img.content)

with open('12306.jpg','wb') as f:
    f.write(img.content)

url = 'https://kyfw.12306.cn/passport/captcha/captcha-check'
code = input('请输入坐标>>>>')
#坐标通过编辑图片的方式打开，选择图片的像素
data = {
    'answer':code.split(' '),
'login_site':'E',
'rand':'sjrand'
    }

res = session.post(url=url,data=data)
print(res.text)

print('执行完毕')